All Questions
392 questions
0votes
2answers
2kviews
index is getting called instead of show
I'm trying to write an API using Ruby on Rails. In my controller class index method is getting called instead of show. Although I am passing parameters. tried these urls http://localhost:3000/api/...
0votes
3answers
555views
Rails: Mailer view with a different name from its action
I want to find the action mailer corresponding to a specific mailer view. It seems that there are no mailer action with the name of the mailer view's name. How can I find the mailer action in this ...
0votes
2answers
483views
How to set website logo image on signup mail in rails?
I am using rails 5 when user is registered in my website i am sending an email for him for account approval.I want to set website logo with email. How we implement this in rails mailer view file Html ...
1vote
1answer
2kviews
error precompiling assets when moving to production
I am trying to move my project to production, trying to RAILS_ENV=production bundle exec rake assets:precompile gives me an error, without specifying in which file it is. rake aborted! Sass::...
0votes
0answers
49views
Model with huge number of fields
I have model Car and fields vin:uniq a_field1 a_field2 a_field3 .. a_field20 b_field1 b_field2 b_field3 .. b_field30. I have two kinds of users Mechanik and Manager. Mechanik can see and edit a_ ...
0votes
0answers
511views
Best use of content_tag in a custom link_to helper method
What is the best way to use a custom helper method in order to generate html tags with links and html options? lets say def drop_document_options(title,document,version,html_options) end in order ...
2votes
1answer
1kviews
Multiple search fields in rails 4
Using Rails 4 and ruby 2.2, I have my User model which has following attributes username email active Now I need to create a search text field for username, email and drop down for active ...
0votes
1answer
492views
Add attachment to email using action Mailer - Rails 4
I have book model which has title, page_no and description. There is another model Image. class Book < ActiveRecord::Base has_many :images, dependent: :destroy end class Image < ...
1vote
2answers
83views
User authentication and authorization for rails app [closed]
Excuse my lack of knowledge, Lately, I am learning rails and found it extremely easy and fun, but still there is alot to learn. I made an application for managing a Car workshop: Owners has many ...
1vote
1answer
260views
validates_uniqueness_of when updating car.number
When updating car info, the validation process fails because I have validates_uniqueness_of :number class Car < ActiveRecord::Base validates :number,numericality: true, length: {is: 7 } validates :...
0votes
1answer
47views
Custom user page for rails using devise - Using Rails 4 and Ruby - 2.2
I am currently using devise for authentication which generates user.rb and controller for user, Welcome page(root page after authentication) which is main page of application where I need to show the ...
0votes
1answer
68views
Multiple t.references get nil value for the second nested models
I have visits who belongs_to owner, and belongs_to car through two t.references, owner_id keeps getting nil when I create new visit through @car.visits.create. Visit.rb class Visit < ActiveRecord:...
0votes
1answer
76views
fields that don't pass validations don't get .field_with_errors class
My validations work fine class Owner < ActiveRecord::Base validates :car_number, :name, :phone, presence:true validates_uniqueness_of :car_number has_many :cars has_many :visits ...
0votes
1answer
1kviews
undefined method `to_i' for :offstfsal:Symbol
I am getting the error undefined method `to_i' for :offstfsal:Symbol in activeadmin. Looks like to_i has been removed. Any suggestion would be helpful. index :title => "Office Expenses" do ...
0votes
0answers
683views
How multiply quantity and price in each item
In Rails, Can not multiply the quantity x price in each items, used in the model file. How multiply the quantity x price in Ruby, And further, if I can do in javascript oriented as the total of each ...